//
//  SubGame.m
//  YouthOlympic2014
//
//  Created by Li Yuhang on 14-7-1.
//  Copyright (c) 2014年 mitian. All rights reserved.
//

#import "SubGame.h"

@implementation SubGame
@synthesize id,name,location;

+ (NSArray*/*SubGame*/) instanceList: (NSDictionary*)jsonData{
    NSArray *jsonSubGames = (NSArray*)jsonData[@"GameSubTypeInfo"];
    NSMutableArray* /*SubGame*/ subgames = [[NSMutableArray alloc]init];
    //
    for(int i=0; i< jsonSubGames.count ; i++){
        SubGame* subgame = [[SubGame alloc]init];
        NSDictionary* subgameJson = jsonSubGames[i];
        subgame.id = subgameJson[@"id"];
        subgame.name = subgameJson[@"name"];
        subgame.location = subgameJson[@"location"];
        [subgames addObject:subgame];
    }
    
    return [NSArray arrayWithArray:subgames];
}

-(NSString *)description{
    return [NSString stringWithFormat: @"{id:%@, name:%@, location:%@}", self.id, self.name, self.location];
}


@end
